import 'package:flutter/cupertino.dart';
import '../../theme/jr.dart';
import 'jr_gradient_painter.dart';

class JRGradientWidget extends StatelessWidget {
  final Decoration? decoration;
  final Gradient? gradient;
  final Widget child;
  const JRGradientWidget(
      {Key? key,
      this.gradient,
      required this.child,
      this.decoration = const ShapeDecoration(
        shape: StadiumBorder(),
      )})
      : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Container(
      clipBehavior: Clip.antiAlias,
      decoration: decoration,
      child: CustomPaint(
        painter: JRGradientPainter(gradient ??
            LinearGradient(
                colors: JR.color.brandGradient,
                begin: AlignmentDirectional.bottomStart,
                end: AlignmentDirectional.topEnd)),
        child: child,
      ),
    );
  }
}
